%% FBMC/OQAM
%% OQAM pre-processing 

function [outdata]=OQAM_preprocessing(indata,q,M);
% outdata:  OQAM output data
% indata:  input data
% q: modulation level
% M: sub-channel number (power of 2) 
X=indata; % input data
Y = qammod(X,q); % QAM modulation 
for k=0:2:M-1 % for k even (k from 0 to M-1)
    v(k+1,:)=[real(Y(k+1)) imag(Y(k+1))]*((i).^(k));
end
for k=1:2:M-1 % for k odd
v(k+1,:)=[imag(Y(k+1)) real(Y(k+1)) ]*((i).^(k));
end
outdata=v; % OQAM output data 

